var webpack = require('webpack');

module.exports = {
  entry: {
    app: './react/app',
    common: ['react', 'react-router', 'react-bootstrap', 'marked', 'co', 'setImmediate', '6to5/polyfill']
  },
  output: {
    filename: 'react/build/[name].js'
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin('react/build/common.js')
  ],
  externals: {
    // react: "React",
    // marked: "marked"
  },
  resolve: {
    extensions: ['', '.jsx', '.js6x', '.js', '.js6', '.coffee', '.html', '.css', '.less']
  },
  module: {
    loaders: [{
        test: /\.jsx$/,
        loader: 'jsx-loader?harmony'
      }, {
        test: /\.js6x$/,
        loader: 'jsx-loader!6to5-loader'
      }, {
        test: /\.js6$/,
        loader: '6to5-loader'
      }, {
        test: /\.less$/,
        loader: 'style-loader!css-loader!less-loader!autoprefixer'
      }, {
        test: /\.css$/,
        loader: 'style-loader!css-loader!autoprefixer'
      }, {
        test: /\.(png|jpg)$/,
        loader: 'url-loader?limit=8192'
      } // inline base64 URLs for <=8k images, direct URLs for the rest
    ]
  }
};